refactor: unify path normalization with pathe#84
Conversation
🦋 Changeset detectedLatest commit: 41c0679 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 926f33eaa6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…shes - KaosPath now normalizes backslashes to forward slashes internally regardless of pathClass (posix or win32). - KaosPath.toLocalPath() returns backslashes on win32 for OS interop. - LocalKaos and SSHKaos both accept backslashes in input paths (pathe normalizes them automatically). - SSHKaos switched from node:path/posix to pathe, removing manual backslash normalization. - Update tests to reflect the new cross-slash behavior.
…rmalization The fakeKaos mock now accepts both backslash and forward slash arguments, matching the behavior of pathe-based path resolution.
b559040 to
ab79fb2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50356521f9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41c0679bf7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
pathe
Related Issue
N/A – internal cleanup.
Problem
The codebase contained four separate copies of a
toForwardSlasheshelper scattered acrosskaosandagent-core. In addition, several files inagent-coreunnecessarily importednode:path/win32and maintained apathModfactory just to switch between POSIX and win32 implementations, even thoughpathealready handles both platforms uniformly. This duplication and platform-branching added noise, caused minor TypeScript type mismatches, and made path handling harder to reason about.What changed
packages/kaos/src/local.tsnode:pathwithpathe.toForwardSlasheshelper;pathe.normalize/pathe.joinnow produce forward-slash paths on Windows automatically.packages/agent-coretools/builtin/file/grep.ts,tools/builtin/file/glob.ts,tools/policies/path-access.ts:toForwardSlashesand thenode:path/win32dependency.relativizeIfUnder,parsedFilePath,canonicalizePath, andisWithinDirectorynow rely onpathe.normalize.agent/permission/path-glob-match.ts,tools/builtin/file/write.ts,tools/support/git-worktree.ts,tools/support/list-directory.ts:pathMod(pathClass)factory and always callpathedirectly.profile/context.ts,profile/load.ts,tools/policies/sensitive.ts,agent/permission/policies/default-git-cwd-write.ts:import * as posixPath from 'pathe'with named imports (dirname,join,basename, etc.).joinPathwrapper.packages/kaos/src/path.tssplitPathLexicallynow splits on'/'instead ofpathMod.sep.KaosPathnormalizes internal win32 paths to forward slashes on construction.Tests
path-guard.test.tswin32 expectations to match the new forward-slash output.path.test.tsto assert forward-slash paths for win32KaosPathinstances.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.